if (localStorage.getItem('user_info')) {
  const uername = JSON.parse(localStorage.getItem('user_info')).username
  // console.log(uername)
  $('.slinks').html(` <a data-v-697ed175="" href="#/user" class="router-link-active"><i data-v-697ed175="" class="fa fa-user"></i>&nbsp; 您好${uername}，</a>
    <a data-v-697ed175="" href="javascript:;" class="fa fa-sign-out"></a>`)
  $('.fa-sign-out').on('click', function () {
    localStorage.removeItem('udd_token')
    localStorage.removeItem('user_info')
    location.href = './index.html'
  })

  $('.router-link-active').on('click', function () {
    location.href = './user.html'
  })
}

// ==========================================导航列表=========================================
; (async function () {
  const { data: { data } } = await axios.get('/index/index')
  // console.log(data)
  const navStr = data.allCate.map(item => `
    <li onclick="capture(${item.id})"  class="menu-item menu-item-type-taxonomy menu-item-object-category" data-id=${item.id}><a href="list.html"><span
        class="fa ${item.icon}"></span>${item.catename}</a></li>
    `).join('')

  $(".nav").html(navStr)

})()


  ; (async function () {
    const { data: { data } } = await axios.get('/index/index')
    const linkStr = data.allLink.slice(15, 30).map(ele => {
      return `<a href="" title="${ele.title}">${ele.des}</a> <span>|</span>`
    }).join('')
    $('.link').html(linkStr)
  })()
